package co.edu.unal.geditor.controller.action.edit.color;

import java.awt.event.ActionEvent;

import co.edu.unal.geditor.controller.App;
import co.edu.unal.geditor.controller.action.undoable.color.UndoableChangeFillingColorAction;
import co.edu.unal.geditor.model.ClosedGraphElement;

public class ChangeFillingColorAction extends ChangeColorAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public ChangeFillingColorAction() {
		// auto-boxing Java feature
		super("Filling Color");
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		super.actionPerformed(e);
		if (color!=null){
			App.getInstance().getDrawing().addUndoable(new UndoableChangeFillingColorAction(App.getInstance().getDrawing().selectedElements()));
			App.getInstance().getDrawing().setFillingColor(color);
		}
		else{
			color=ClosedGraphElement.getDefaultFillingColor();
		}
		
	}
}
